package it.polimi.sartori_daniello_picca.meteocal.gui;

import it.polimi.sartori_daniello_picca.meteocal.boundary.EventManager;
import it.polimi.sartori_daniello_picca.meteocal.boundary.NotificationManager;
import it.polimi.sartori_daniello_picca.meteocal.boundary.UserManager;
import it.polimi.sartori_daniello_picca.meteocal.entity.Notification;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import javax.ejb.EJB;

/**
 *
 * @author Ale
 */
public class NotificationBean {
     @EJB
     private NotificationManager nm;
             
     @EJB
     private UserManager um;
      
     @EJB
     private EventManager em;
     
     private List<Notification> weather3day;
     private List<Notification> weather1day;
     private List<Notification> invitation;
     private List<Notification> friendship;
     private List<Notification> modification;
     private List<Notification> allnotification;
     
     private static ConcurrentHashMap<String, Notification> selectedInvitationMap;
     private static ConcurrentHashMap<String, Notification> selectedFriendshipMap;
     private static ConcurrentHashMap<String, Notification> selectedModificationMap;
     private static ConcurrentHashMap<String, Notification> selectedWeather1dayMap;
     private static ConcurrentHashMap<String, Notification> selectedWeather3dayMap;
     
     public NotificationBean() {
        allnotification = nm.findNotificationByReceiver(um.getLoggedUser()); 
        invitation = new ArrayList<>();
        modification= new ArrayList<>();
        weather1day= new ArrayList<>();
        weather3day= new ArrayList<>();
     }
     
     public void  declineInvitation() {
         nm.remove(selectedInvitationMap.get(um.getLoggedUser().getUsername()));
     }
     
     public void  declineFriendship() {
         nm.remove(selectedFriendshipMap.get(um.getLoggedUser().getUsername()));
     }
     
     public void acceptModification(){
         //todo
     }
     
     public void declineModification(){
         //todo
     }
     
     
}
